package com.gdut.wifidemo.utils;

import android.util.Log;

public class LogUtils {

    private static final boolean isEnable = true;

    private static final String DEFAULT_TAG = "WifiDemo";

    public static void d(String TAG, String format, Object... args) {
        try {
            if (args == null || args.length <= 0) {
                if (isEnable) {
                    Log.d(TAG, format);
                }
            } else {
                if (isEnable) {
                    Log.d(TAG, String.format(format, args));
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void d(String message) {
        d(DEFAULT_TAG, message);
    }

    public static void e(String TAG, String format, Object... args) {
        try {
            if (args == null || args.length <= 0) {
                if (isEnable) {
                    Log.e(TAG, format);
                }
            } else {
                if (isEnable) {
                    Log.e(TAG, String.format(format, args));
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void e(String message) {
        e(DEFAULT_TAG, message);
    }

}
